<?php
namespace ZyucMini\Components\Expert\Services;

use ZyucMini\Components\Connections\Connections;
use ZyucMini\Components\Expert\Models\User AS ExpUserModel;

class User {

    protected $user_model;

    public function __construct() {
        Connections::initAll();
    }

    public function getMap() {
        $users = $this->getAll();
        $userMap = [];
        foreach($users as $user) {
            $userMap[$user['user_id']] = $user['user_name'];
        }
        return $userMap;
    }

    // 查询所有专家列表
    public function getAll() {
        if(!$this->user_model) {
            $this->user_model = new ExpUserModel();
        }
        return $this->user_model->getActives();
    }
    
}
?>